{{ extend layout() }}

<h2>Cache</h2>
<div class="wrapper">

<div class="list right-side">
    <div class="list-header">
    Heapy Statistics
    </div>
    <div class="content">
	{{lgh = latest_guppy_heapy()
	  agh = average_guppy_heapy()	
	}}
		<h3>Bytes / Memory Usage</h3>
		<p> 
			Latest Bytes: <strong>{{=lgh['bytes']}}</strong> bytes 
			{{if lgh['bytes'] > 524287:}}
				 (<strong>{{=lgh['bytes'] / 1048576}} MB</strong>)
			{{pass}}
			<small> Measured on {{=lgh['measured_on'].strftime("%Y-%m-%d %I:%M %p")}}</small>
		</p>
		<p> 
			Average Bytes: <strong>{{=agh['bytes']}}</strong> bytes 
            {{if agh['bytes'] > 524287:}}
                 (<strong>{{=agh['bytes'] / 1048576}} MB</strong>)
            {{pass}}
		</p>
		<h3>Objects</h3>
		<p> 
			Latest Object Count: <strong>{{=lgh['objects']}}</strong>
			<small> Measured on {{=lgh['measured_on'].strftime("%Y-%m-%d %I:%M %p")}}</small>
		</p>
		<p> 
			Average Object Count: <strong>{{=agh['objects']}}</strong>
		</p>
		<h3>Latest Breakdown</h3>
		<p>
			{{=WIKI(lgh['text'])}}
		</p>
    </div>
</div>
<div class="list">
    <div class="list-header">
        Statistics
    </div>
    <div class="content">
        <h3>Overview</h3>
        <p>
            Hit Ratio: 
            <strong>{{=total['ratio']}}%</strong> 
            (<strong>{{=total['hits']}}</strong> hits 
            and <strong>{{=total['misses']}}</strong> misses)
        </p>
        <p>
            Size of cache: 
            <strong>{{=total['objects']}}</strong> items, 
            <strong>{{=total['bytes']}}</strong> bytes 
            {{if total['bytes'] > 524287:}}
                (<strong>{{="%.0d" % (total['bytes'] / 1048576)}} MB</strong>)
            {{pass}}
        </p>
        <p>
            Cache contains items up to 
            <strong>{{="%02d" % total['oldest'][0]}}</strong> hours 
            <strong>{{="%02d" % total['oldest'][1]}}</strong> minutes 
            <strong>{{="%02d" % total['oldest'][2]}}</strong> seconds old.
        </p>
        <h3>RAM</h3>
        <p>
            Hit Ratio: 
            <strong>{{=ram['ratio']}}%</strong> 
            (<strong>{{=ram['hits']}}</strong> hits 
            and <strong>{{=ram['misses']}}</strong> misses)
        </p>
        <p>
            Size of cache: 
            <strong>{{=ram['objects']}}</strong> items, 
            <strong>{{=ram['bytes']}}</strong> bytes 
            {{if ram['bytes'] > 524287:}}
                (<strong>{{=ram['bytes'] / 1048576}} MB</strong>)
            {{pass}}
        </p>
        <p>
            RAM contains items up to 
            <strong>{{="%02d" % ram['oldest'][0]}}</strong> hours 
            <strong>{{="%02d" % ram['oldest'][1]}}</strong> minutes 
            <strong>{{="%02d" % ram['oldest'][2]}}</strong> seconds old.
        </p>
        <h3>DISK</h3>
        <p>
            Hit Ratio: 
            <strong>{{=disk['ratio']}}%</strong> 
            (<strong>{{=disk['hits']}}</strong> hits 
            and <strong>{{=disk['misses']}}</strong> misses)
        </p>
        <p>
            Size of cache: 
            <strong>{{=disk['objects']}}</strong> items, 
            <strong>{{=disk['bytes']}}</strong> bytes 
            {{if disk['bytes'] > 524287:}}
                (<strong>{{=disk['bytes'] / 1048576}} MB</strong>)
            {{pass}}
        </p>
        <p>
            DISK contains items up to 
            <strong>{{="%02d" % disk['oldest'][0]}}</strong> hours 
            <strong>{{="%02d" % disk['oldest'][1]}}</strong> minutes 
            <strong>{{="%02d" % disk['oldest'][2]}}</strong> seconds old.
        </p>
    </div>
	
    <div class="list-header">
    Manage Cache
    </div>
    <div class="content">
	<p>
        {{=form}}
	</p>
    </div>
</div>
<div class="clear"></div>
</div>
